package com.yyg.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yyg.entity.EasyUser;
import com.yyg.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Service
public class EasyUserService extends ServiceImpl<UserMapper, EasyUser> {
    @Autowired
    private UserMapper userMapper;

    public EasyUser CheckLogin(EasyUser user){
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.eq("username",user.getUsername());
        EasyUser easyUsers= userMapper.selectOne(queryWrapper);
        if (easyUsers==null){
            return null;
        }else{
            if (easyUsers.getPassword().equals(user.getPassword())){
                return easyUsers;//用户名密码正确
            }else{
                return null;
            }
        }
    }
}
